/*
*   Copyright: Fabian Hajek (2012)  Programmieren: C   -   Semesterarbeit WS 2011/2012
*
*   Projekt: Schreinerei.exe
*
*   Author: $Author: webmaster@die-schwarzen-schwaben.de $
*
*   Name: search.c
*   URL:    $URL: http://semesterarbeit-wi-11-12.googlecode.com/svn/trunk/Semesterarbeit2/Schreinerei/Funktionen/search.c $
*
*   Description:   Sucht Ressource, Schritte, Arbeitsschritte und liefer Pointer zurueck
*
*   Last update:    $Date: 2012-02-24 21:45:10 +0000 (Fri, 24 Feb 2012) $
*
*   Rev:      $Rev: 56 $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../default/structures.h"
#include "../Definitionen/define.h"
#include "search.h"

SCHRANK * search_schrank(char name[])
{
    SCHRANK *out;
    p_schrank = p_schrank_end;
    while(p_schrank)
    {
        if(!strcmp(name,p_schrank->name))
        {
            out = p_schrank;
        }
        p_schrank = p_schrank->prev_schrank;
    }

    return out;
}

RESSOURCE * search_ressource(char name[])
{
    RESSOURCE *out;
    p_ressource = p_ressource_end;
    while(p_ressource)
    {
        if(!strcmp(name,p_ressource->name))
        {
            out = p_ressource;
        }
        p_ressource = p_ressource->prev_ressource;
    }

    return out;
}

STEP * search_step(char name[])
{
    STEP *out;
    p_step = p_step_end;
    while(p_step)
    {
        if(!strcmp(name,p_step->name))
        {
            out = p_step;
        }
        p_step = p_step->prev_step;
    }

    return out;
}
